    <!DOCTYPE html>
    <html>
    <head>
        <title>鼠标放上盒子变色盒子大小改变</title>
        <style>
            div{
                background-color: #7AB800;
                width: 500px;
                height: 500px;
            }
            .box1{
                background-color: #000000;
                width: 200px;
                height: 200px;
            }
        </style>
    </head>
    <body>
    <div class="box"></div>
    <script>
        var box=document.getElementsByClassName("box")[0];
        box.onclick=function () {
            box.className="box1";
        }
    </script>
    </body>
    </html>